<ProfilePanel>:
    orientation: 'vertical'
    activity_grid: activity_grid
    activity_scroll_view: activity_scroll_view
    ProfileHeader:
        size_hint_y: None
        height: sp(75)
        posts: root.posts
        username: root.username 
    ProfileFeed:
        on_scroll_y: root.evaluate_prefetch(self.scroll_y)
        id: activity_scroll_view
        size: self.size  
        padding_y: sp(10)
        container_height: activity_grid.height
        GridLayout:
            padding: [10, 10, 10, 10]
            id: activity_grid
            cols: 3 
            size_hint_y: None
            row_force_default: True
            col_force_default: True
            col_default_width: self.width / 3
            row_default_height: self.col_default_width


<ProfileHeader>:
    BoxLayout:
        orientation: 'vertical'
        Label:
            text: root.username
            bold: True
            font_size: sp(25)
            text_size: self.size
            halign: 'left'
            valign: 'middle'
            padding_x: sp(15)
    BoxLayout:
        id: profile_stats
        padding: 0, 0, sp(15), 0
        spacing: sp(15)
        BoxLayout:
        ProfileDetails:
            size_hint_x: None
            value: root.posts
            noun: 'posts'
        
        # will use these when following/followers features get implemented
        # ProfileDetails:
        #     value: root.followers
        #     noun: 'followers'
        # ProfileDetails:
        #     value: root.following
        #     noun: 'following'


<ProfileDetails@BoxLayout>:
    orientation: 'vertical'
    value: 0
    noun: '' 
    BoxLayout:
    Label:
        text: str(root.value)
        bold: True
        color: 1, 1, 1, 1
        font_size: sp(25)
        size_hint_y: None
        height: self.texture_size[1]
    Label:
        text: root.noun
        color: utils.get_color_from_hex(utils.hex_colormap["lightgray"])
        size_hint_y: None
        height: self.texture_size[1]
    BoxLayout:


<RecentActivityItem>:
    padding: [sp(1), sp(1), sp(1), sp(1)]
    on_release: root.open_activity()
    background_normal: ''
    background_color: 0,0,0,0
    StencilView: 
        id: stencil
        AsyncImage:
            allow_stretch: True
            source: root.image_source 
            width: stencil.width + (self.height - self.texture_size[1]) if self.texture_size[1] <= self.texture_size[0] else stencil.width
            height: stencil.height + (self.width - self.texture_size[0]) if self.texture_size[1] > self.texture_size[0] else stencil.height
            x: stencil.x - ((self.height - self.texture_size[1]) / 2) if self.texture_size[1] <= self.texture_size[0] else stencil.x
            y: stencil.y - ((self.width - self.texture_size[0]) / 2) if self.texture_size[1] > self.texture_size[0] else stencil.y


<LogOutButton>:
    text: 'log out'
    size_hint: None, None
    size: self.texture_size
    padding_x: sp(10)
    padding_y: sp(10)
    on_release: self.log_out()
    pos_hint: {'center_y': 0.5}
    background: ''
